// 用法:
//      async {{function}}() {
//          let something = await this.$api.getSomething(params,headers);
//      }
//      params       optional    ajax请求的参数 GET请求放在query string、其他请求放在request body
//      headers      optional    ajax请求的headers
export default {
  //登录相关api
  findBackPassword(params, headers) {
    return this.getData({
      url: '/auth/findBackPassword',
      method: 'POST'
    }, params, headers)
  },
  getConversationId(params, headers) {
    return this.getData({
      url: '/auth/getConversationId',
      method: 'GET'
    }, params, headers)
  },
  logout(params, headers) {
    return this.getData({
      url: '/auth/logout',
      method: 'POST'
    }, params, headers)
  },
  sendPhoneCode(params, headers, id) {
    return this.getData({
      url: '/auth/sendFindPhoneCode/' + id,
      method: 'POST'
    }, params, headers)
  },
  authUser(params, headers) {
    return this.getData({
      url: '/auth/user',
      method: 'GET'
    }, params, headers)
  },
  getVerificationPicture(id, params, headers) {
    return this.getData({
      url: '/auth/verificationPicture/' + id,
      method: 'GET'
    }, params, headers)
  },

  // 用户管理相关api
  setUserBalance(params,type) {
    let url = ''
    if (type === 'add') {
      url = '/admin/user/balance/add'
    } else {
      url = '/admin/user/balance/minus'
    }
    return this.getData({
      url,
      method: 'POST'
    }, params)
  },
  initUserPassword(params, headers) {
    return this.getData({
      url: '/admin/user/password',
      method: 'POST'
    }, params, headers)
  },
  setUserStatus(params, headers) {
    return this.getData({
      url: '/admin/user/status',
      method: 'POST'
    }, params, headers)
  },

  //京币管理api
  confirmChargeRecord(params, headers) {
    return this.getData({
      url: '/admin/payment/confirmReadCharge',
      method: 'POST'
    }, params, headers)
  },
  deleteRecord(params, headers) {
    return this.getData({
      url: '/admin/payment/readCharge/delete',
      method: 'DELETE'
    }, params, headers)
  },
}